CC=gcc
CFLAGS=-W -Wall -g -fpic
LDFLAGS=-lopa -pthread
EXEC=pgr
SRC= $(wildcard *.c)
OBJ= $(SRC:.c=.o)
LIB = lib
all: $(EXEC) $(LIB)

lib:
	@$(CC) -c $(CFLAGS) $(SRC)
	@$(CC) -shared -o libthread.so *.o

pgr: $(OBJ)
	@$(CC) -o $@ $^ $(LDFLAGS)

%.o: %.c
	@$(CC) -o $@ -c $< $(CFLAGS)

.PHONY: clean mrproper

clean:
	@rm *.o


mrproper: clean
	@rm $(EXEC)
